<!DOCTYPE html>
<html>
<head>
<style>
/* 隐藏所有选项卡内容 */
.tabcontent {
  display: none;
}

/* 设置选项卡按钮样式 */
.tab {
  background-color: #f1f1f1;
  overflow: hidden;
}

/* 设置选项卡按钮的样式 */
.tab button {
  background-color: inherit;
  float: left;
  border: none;
  outline: none;
  cursor: pointer;
  padding: 14px 16px;
  transition: 0.3s;
}

/* 设置选项卡按钮的激活样式 */
.tab button.active {
  background-color: #ccc;
}

/* 设置选项卡内容的样式 */
.tabcontent {
  padding: 20px;
  border: 1px solid #ccc;
}

</style>
</head>
<body>

<!-- 选项卡按钮 -->
<div class="tab">
  <button class="tablinks" onclick="openTab(event, 'Page1')">网页1</button>
  <button class="tablinks" onclick="openTab(event, 'Page2')">网页2</button>
  <button class="tablinks" onclick="openTab(event, 'Page3')">网页3</button>
</div>

<!-- 选项卡内容 -->
<div id="Page1" class="tabcontent">
  <h3>网页1</h3>
  <p>这是网页1的内容。</p>
</div>

<div id="Page2" class="tabcontent">
  <h3>网页2</h3>
  <p>这是网页2的内容。</p>
</div>

<div id="Page3" class="tabcontent">
  <h3>网页3</h3>
  <p>这是网页3的内容。</p>
</div>

<script>
// 默认显示第一个选项卡
document.getElementById("Page1").style.display = "block";

function openTab(evt, tabName) {
  var i, tabcontent, tablinks;

  // 隐藏所有选项卡内容
  tabcontent = document.getElementsByClassName("tabcontent");
  for (i = 0; i < tabcontent.length; i++) {
    tabcontent[i].style.display = "none";
  }

  // 移除所有选项卡按钮的激活状态
  tablinks = document.getElementsByClassName("tablinks");
  for (i = 0; i < tablinks.length; i++) {
    tablinks[i].className = tablinks[i].className.replace(" active", "");
  }

  // 显示当前选项卡内容并设置按钮为激活状态
  document.getElementById(tabName).style.display = "block";
  evt.currentTarget.className += " active";
}
</script>

</body>
</html>
